<!--{template common/header}-->

<style type="text/css">
#MathInput {
	width:95%;/*自动适应父布局宽度*/
	overflow:auto;
	min-width: 20em;
}
.output {
	border: 1px solid black;
	padding: 1em;
	height: 15em;
	width: auto;
	position: relative; top: 0; left: 0;
	min-width: 20em;
}
.box {position: relative}
</style>

<script>
	// 
	// math update function
	//
	window.mathUpdate = function(inbox, outbox) {
			katex.render(inbox.value, outbox, {
					displayMode: true,
					output: "html"
				});
		}
</script>

<div class="p_opt cl">
	<h3 class="flb">
		<em id="close_mathjax">LaTeX公式输入</em>
		<span>
			<!--{if !empty($_G['gp_infloat'])}--><a href="javascript:;" class="flbc" onclick="hideWindow('katex_edit_window');" title="关闭">关闭</a><!--{/if}-->
		</span>
	</h3>
	<p class="pbn">友情提示：请先写好标题再插入公式</p>
	<p class="pbn">否则公式可能会插入失败</p>

	<p class="pbn">
	<textarea id="MathInput" onkeyup="mathUpdate(this, document.getElementById('MathOutput'));" placeholder="Type some Tex formula here. Enjoy!"></textarea>
	</p>

	<p class="pbn">
	<div class="box" id="box">
		<div id="MathOutput" class="output"><p><I>此处会显示公式预览~</I></p></div>
	</div>
	</p>

	<p class="pbn">       
	<div class="pns mtn">
		<button type="submit" id="mathjax_submit2" onclick="insertText('$$'+document.getElementById('MathInput').value+'$$'); hideWindow('katex_edit_window') " class="pn pnc"><strong>OK</strong></button>
	</div>
	</p>
</div>

<!--{template common/footer}-->
